<template>
  <view class="type-wrapper">
    <view 
      class="type-item" 
      :class="{ active: isActive }"
      @click="handleClick"
    >
      <view class="item-content">
        <text class="type-text">{{ text }}</text>
      </view>
    </view>
    <view class="type-background" :class="{ 
      active: isActive,
      inactive: !isActive 
    }"></view>
  </view>
</template>

<script setup>
defineProps({
  text: {
    type: String,
    required: true
  },
  isActive: {
    type: Boolean,
    default: false
  }
})

const emit = defineEmits(['click'])

const handleClick = () => {
  emit('click')
}
</script>

<style lang="scss" scoped>
.type-wrapper {
  position: relative;
  width: 490rpx;
  height: 160rpx;
}

.type-item {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #FFFFFF;
  border: 2rpx solid #B5B5B5;
  border-radius: 20rpx;
  width: 490rpx;
  height: 140rpx;
  
  &.active {
    border: 2rpx solid #FAC653;
  }
}

.type-background {
  position: absolute;
  z-index: 1;
  left: 6rpx;
  top: 20rpx;
  width: 490rpx;
  height: 140rpx;
  border-radius: 20rpx;
  transition: all 0.3s ease;
  
  &.active {
    background: #FAC653;
  }
  
  &.inactive {
    background: #B5B5B5;
  }
}

.item-content {
  display: flex;
  align-items: center;
  justify-content: center;
}

.type-text {
  font-family: PingFangSC-Medium;
  font-size: 32rpx;
  color: #000000;
  letter-spacing: 0;
  text-align: center;
  font-weight: 500;

}
</style> 